<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>xilnvm: XilNvm BBRAM Server APIs</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="HTML_custom.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="xlogo_bg.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">xilnvm
   </div>
   <div id="projectbrief">Vitis Drivers API Documentation</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Overview</span></a></li>
      <li><a href="annotated.html"><span>Data&#160;Structures</span></a></li>
      <li><a href="globals.html"><span>APIs</span></a></li>
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;"
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__xnvm__bbram__server__apis.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">XilNvm BBRAM Server APIs</div>  </div>
</div><!--header-->
<div class="contents">
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="define-members"></a>
Macros</h2></td></tr>
<tr class="memitem:ga6ebc086461092546789c62ddbd362948"><td class="memItemLeft" align="right" valign="top">#define&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__xnvm__bbram__server__apis.html#ga6ebc086461092546789c62ddbd362948">REVERSE_POLYNOMIAL</a>&#160;&#160;&#160;(0x82F63B78U)</td></tr>
<tr class="memdesc:ga6ebc086461092546789c62ddbd362948"><td class="mdescLeft">&#160;</td><td class="mdescRight">Polynomial used for CRC calculation.  <a href="#ga6ebc086461092546789c62ddbd362948">More...</a><br/></td></tr>
<tr class="separator:ga6ebc086461092546789c62ddbd362948"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga3d264db9b87c4fe29a755a02f0bad72f"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__xnvm__bbram__server__apis.html#ga3d264db9b87c4fe29a755a02f0bad72f">XNvm_BbramLockUsrDataWrite</a> (void)</td></tr>
<tr class="memdesc:ga3d264db9b87c4fe29a755a02f0bad72f"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function locks the user data written in BBRAM_8 that is making user data written in BBRAM as read only.  <a href="#ga3d264db9b87c4fe29a755a02f0bad72f">More...</a><br/></td></tr>
<tr class="separator:ga3d264db9b87c4fe29a755a02f0bad72f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga85d604d634dbf207503a9128fee84a50"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__xnvm__bbram__server__apis.html#ga85d604d634dbf207503a9128fee84a50">XNvm_BbramWriteAesKey</a> (const u8 *Key, u16 KeyLen)</td></tr>
<tr class="memdesc:ga85d604d634dbf207503a9128fee84a50"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function does programming of key provided into BBRAM and validates CRC of the key stored in BBRAM with CRC of input key.  <a href="#ga85d604d634dbf207503a9128fee84a50">More...</a><br/></td></tr>
<tr class="separator:ga85d604d634dbf207503a9128fee84a50"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gade0b7ce1639f068fb871c52eccfef0b0"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__xnvm__bbram__server__apis.html#gade0b7ce1639f068fb871c52eccfef0b0">XNvm_BbramWriteUsrData</a> (u32 GeneralPurposeData)</td></tr>
<tr class="memdesc:gade0b7ce1639f068fb871c52eccfef0b0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Writes user provided 32-bit data to BBRAM.  <a href="#gade0b7ce1639f068fb871c52eccfef0b0">More...</a><br/></td></tr>
<tr class="separator:gade0b7ce1639f068fb871c52eccfef0b0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gafcee46d7df5018a118844238cf4e3f65"><td class="memItemLeft" align="right" valign="top">u32&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__xnvm__bbram__server__apis.html#gafcee46d7df5018a118844238cf4e3f65">XNvm_BbramReadUsrData</a> (void)</td></tr>
<tr class="memdesc:gafcee46d7df5018a118844238cf4e3f65"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function reads 32-bit user data from BBRAM_8 register.  <a href="#gafcee46d7df5018a118844238cf4e3f65">More...</a><br/></td></tr>
<tr class="separator:gafcee46d7df5018a118844238cf4e3f65"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga689df607f805a008e64d9c2a181b2f17"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__xnvm__bbram__server__apis.html#ga689df607f805a008e64d9c2a181b2f17">XNvm_BbramZeroize</a> (void)</td></tr>
<tr class="memdesc:ga689df607f805a008e64d9c2a181b2f17"><td class="mdescLeft">&#160;</td><td class="mdescRight">This function zeroizes the BBRAM.  <a href="#ga689df607f805a008e64d9c2a181b2f17">More...</a><br/></td></tr>
<tr class="separator:ga689df607f805a008e64d9c2a181b2f17"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Macro Definition Documentation</h2>
<a class="anchor" id="ga6ebc086461092546789c62ddbd362948"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">#define REVERSE_POLYNOMIAL&#160;&#160;&#160;(0x82F63B78U)</td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Polynomial used for CRC calculation. </p>

<p>Referenced by <a class="el" href="group__xnvm__util__apis.html#ga05857cc7a1c346b57ab04e5f1fb0edb5">XNvm_AesCrcCalc()</a>.</p>

</div>
</div>
<h2 class="groupheader">Function Documentation</h2>
<a class="anchor" id="ga3d264db9b87c4fe29a755a02f0bad72f"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int XNvm_BbramLockUsrDataWrite </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function locks the user data written in BBRAM_8 that is making user data written in BBRAM as read only. </p>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li>XST_SUCCESS Success in locking the BBRAM user data.</li>
<li>XNVM_BBRAM_ERROR_LOCK_USR_DATA_WRITE Failure to lock BBRAM user data. </li>
</ul>
</dd></dl>
<p>Write to BBRAM Lock register and readback to confirm if lock is successful. Return the status of the lock, Success if the lock is done else error.</p>

<p>References <a class="el" href="xnvm__bbram_8h.html#abe4a861137aa2ba239f599b20a23612c">XNVM_BBRAM_ERROR_LOCK_USR_DATA_WRITE</a>, and <a class="el" href="xnvm__bbram__hw_8h.html#a6d26b912dbfc8709d217f9dc3b0f6b15">XNVM_BBRAM_MSW_LOCK</a>.</p>

</div>
</div>
<a class="anchor" id="gafcee46d7df5018a118844238cf4e3f65"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">u32 XNvm_BbramReadUsrData </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function reads 32-bit user data from BBRAM_8 register. </p>
<dl class="section return"><dt>Returns</dt><dd>32-bit user data stored in BBRAM_8 register </dd></dl>
<p>Read the 32 bit user data from the BBRAM_8 register and return it</p>

</div>
</div>
<a class="anchor" id="ga85d604d634dbf207503a9128fee84a50"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int XNvm_BbramWriteAesKey </td>
          <td>(</td>
          <td class="paramtype">const u8 *&#160;</td>
          <td class="paramname"><em>Key</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">u16&#160;</td>
          <td class="paramname"><em>KeyLen</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function does programming of key provided into BBRAM and validates CRC of the key stored in BBRAM with CRC of input key. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">Key</td><td>- Pointer to hex buffer which is pointing to key </td></tr>
    <tr><td class="paramname">KeyLen</td><td>- XNVM_256_BITS_AES_KEY_LEN_IN_BYTES for 256-bit AES key</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li>XST_SUCCESS Key is written to BBRAM.</li>
</ul>
</dd></dl>
<ul>
<li>XST_INVALID_PARAM Invalid parameter passed.</li>
<li>XNVM_BBRAM_ERROR_PGM_MODE_ENABLE_TIMEOUT Timeout during enabling programming mode.</li>
<li>XNVM_BBRAM_ERROR_PGM_MODE_DISABLE_TIMEOUT Timeout during disabling programming mode.</li>
<li>XNVM_BBRAM_ERROR_AES_CRC_DONE_TIMEOUT CRC validation check timed out.</li>
<li>XNVM_BBRAM_ERROR_AES_CRC_MISMATCH CRC mismatch. </li>
</ul>
<p>Perform input parameter validation. Return appropriate error code if input parameters are invalid.</p>
<p>Assign the key address to local pointer.</p>
<p>Bring BBRAM to programming mode by writing Magic Word 0x757BDF0D to PGM_MODE register.</p>
<p>Write 256-bit AES Key to BBRAM registers BBRAM_0 to BBRAM_7.</p>
<p>Calculate CRC on input AES Key and write it to BBRAM_AES_CRC which triggers BBRAM CRC integrity check. Wait for AES_CRC_DONE bit to set in BBRAM_STATUS register with timeout of 1 second. If timed out return timeout error. If AES_CRC_PASS bit is set in BBRAM_STATUS register, return XST_SUCCESS else return CRC mismatch error.</p>
<p>Disable BBRAM programming mode by writing 0x00 to PGM_MODE register.</p>

<p>References <a class="el" href="group__xnvm__bbram__client__api.html#gae4085a2c2243377cae4029f3236684e7">XNvm_BbramZeroize()</a>.</p>

</div>
</div>
<a class="anchor" id="gade0b7ce1639f068fb871c52eccfef0b0"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int XNvm_BbramWriteUsrData </td>
          <td>(</td>
          <td class="paramtype">u32&#160;</td>
          <td class="paramname"><em>GeneralPurposeData</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Writes user provided 32-bit data to BBRAM. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">GeneralPurposeData</td><td>- 32-bit user data to be written to BBRAM</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li>XST_SUCCESS User data written to BBRAM</li>
<li>XNVM_BBRAM_INVALID_PARAM Invalid input parameter</li>
</ul>
</dd></dl>
<ul>
<li>XNVM_BBRAM_ERROR_USR_DATA_WRITE_LOCKED Failure since write is locked for the register</li>
</ul>
<dl class="section note"><dt>Note</dt><dd>Provisoning of general purpose data is allowed only if Symmetric/Asymeetric HWRoT boot is not enabled for Versal Gen 2 devices </dd></dl>

</div>
</div>
<a class="anchor" id="ga689df607f805a008e64d9c2a181b2f17"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int XNvm_BbramZeroize </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>This function zeroizes the BBRAM. </p>
<dl class="section return"><dt>Returns</dt><dd><ul>
<li>XST_SUCCESS Success in Zeroization of BBRAM.</li>
<li>XNVM_BBRAM_ERROR_ZEROIZE_TIMEOUT If Timed out during BBRAM zeroization </li>
</ul>
</dd></dl>
<p>Write 1 to BBRAM_CTRL register. Wait for BBRAM_ZEROIZED bit to set in BBRAM_STATUS register with timeout of 1 second. If timed out return timeout error. Return XST_SUCCESS.</p>

<p>References <a class="el" href="xnvm__bbram__hw_8h.html#a791e4d21765eb196c6e2819bea01c443">XNVM_BBRAM_BASE_ADDR</a>, <a class="el" href="xnvm__bbram__hw_8h.html#a065b3b8d7d6be2ebeffb4974df61863f">XNVM_BBRAM_CTRL_START_ZEROIZE</a>, <a class="el" href="xnvm__bbram_8h.html#aa9a7eb5fa36c8914dda4fa5fd858c363">XNVM_BBRAM_ERROR_ZEROIZE_TIMEOUT</a>, and <a class="el" href="xnvm__bbram__hw_8h.html#a7caf87ce570f0ba169e55ce0bd3faf69">XNVM_BBRAM_STATUS_REG</a>.</p>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
	<p class="footer">&copy; Copyright 2015-2022 Xilinx, Inc. All Rights Reserved.</p>
	<p class="footer">&copy; Copyright 2022-2023 Advanced Micro Devices, Inc. All Rights Reserved.</p>
</div>
</body>
</html>
